﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Pseudogenerator.Common.Generators;
using Pseudogenerator.Common.Generators.Core;
using Pseudogenerator.Common.Checkers.Core;
using Pseudogenerator.Common.Checkers;
using System.Threading.Tasks;
using System.Windows.Input;

namespace Pseudogenerator.Common.ViewModels.Core
{
    public abstract class WorkSpaceViewModel<T> 
        : WorkSpaceViewModel
        where T : MethodBase
    {


        public override bool CanRun
        {
            get
            {
                return ModeloActual.m > ModeloActual.x0 &&
                       !InWorkProgress;
            }
        }


        private ObservableCollection<T> _Preloads = null;
        public ObservableCollection<T> Preloads
        {
            get
            {
                if (_Preloads == null)
                    _Preloads = new ObservableCollection<T>();

                return _Preloads;
            }
            private set
            {
                this._Preloads = value;
            }
        }

        public abstract T ModeloActual { get; set; }
        protected override void LoadSync()
        {
            Results = new ObservableCollection<RandomNumber>(ModeloActual.GetFullList());
            OnPropertyChanged("Results");
            OnPropertyChanged("Tests");
            InWorkProgress = false;
        }
    }
}
